package com.netty.xintiao;

import com.netty.socket.service.SocketServiceHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;


/**
 * Created by Administrator on 2018/9/9/009.
 */
public class XinTiaoServiceInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) {
        //空闲状态监测的处理器
        ch.pipeline().addLast(new IdleStateHandler(5, 7, 10, TimeUnit.SECONDS));
        ch.pipeline().addLast(new SocketServiceHandler());
    }
}
